package com.bobo.demo.Thread;

//lambda表达式初识
public class TestLambda {
    public static void main(String[] args) {
        //1 简化1
        ILove iLove1 = (int a) ->{
            System.out.println("love program1");
        };

        //2 简化参数类型
        ILove iLove2 = (a) ->{
            System.out.println("love program2");
        };

        //3 简化括号
        ILove iLove3 = a ->{
            System.out.println("love program3");
        };

        //4 简化成一行去掉花括号，但是代码必须只有一行
        ILove iLove4 = a -> System.out.println("love program4");

        //5 假如是两个参数，则用括号括起来
//        ILove iLove5 = (a,b) -> System.out.println("love program5");

        iLove1.love(1);
        iLove2.love(1);
        iLove3.love(1);
        iLove4.love(1);
    }
}

interface ILove {
    //必须只有一个抽象方法，多个则违反lambda原则
    void love(int a);
}